<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="js/jquery-1.10.2.js"></script>
	</head>
	<body>
		<button onclick="gogo()">发AJAX 请求</button>
		<table id="info" border="1"></table>
	</body>
	<script>
		var path="http://localhost:8080/json";
		function gogo(){
			console.log(path);
			$.ajax({
				url:path,
				type:"POST",
				dataType:"json",
				success:function(result){
					show(result);
				},
				error:function(){
					$("#info").html("请求失败");
				}
			});
			function show(ss) {
				var tb = document.querySelector("table");
				for (i = 0; i < ss.length; i++) {
					var tr = tb.insertRow();//新建行
					var td = tr.insertCell();
					td.innerText = ss[i].stid;
					var td1 = tr.insertCell();
					td1.innerText = ss[i].stname;
					var td2 = tr.insertCell();
					td2.innerText = ss[i].stpass;
				}
			}
		}
	</script>
</html>
